package com.htbb.base.util;

import java.util.regex.Pattern;

public class LoginUtils {

	public static String getNum(String num) {
		char[] charArray = num.toCharArray();
		if (isNumeric(num) && charArray[0] == 48) {
			String temp = "";
			boolean flag = true;
			for (char c : charArray) {
				String aString = String.valueOf(c);
				if(flag){
					if (!aString.equals("0")) {
						flag = false;
						temp += aString;
					}
				}else{
					temp += aString;
				}
			}
			return temp;
		}
		return num;
	}

	public static boolean isNumeric(String str) {

		for (int i = str.length(); --i >= 0;) {

			int chr = str.charAt(i);

			if (chr < 48 || chr > 57)

				return false;

		}
		return true;

	}

	 // 只能判断部分CJK字符（CJK统一汉字）
    public static boolean isChineseByREG(String str) {
        if (str == null) {
            return false;
        }
        Pattern pattern = Pattern.compile("[A-Za-z\\u4E00-\\u9FBF]+");
        return pattern.matcher(str.trim()).matches();
    }
}
